<!--
@author cairq@ucweb.com
-->
<%@page import="com.uc.browser.useragent.UserAgent"%>
<%@page import="com.uc.browser.useragent.XUCBrowserUserAgent"%>
<%@ page import="com.uc.browser.useragent.UserAgentFactory"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>User-Agent Test</title>
        <script type="text/javascript">
            function parseUserAgent(){
                document.getElementById("actionType").value = "ua";
                document.forms[0].submit();
            }
            
            function parseXUCBrowserUA(){
                document.getElementById("actionType").value = "xua";
                document.forms[0].submit();
            }
            
            function clearData(){
                document.getElementById("text").value = "";
                document.getElementById("parsetResult").value = "";
            }
        </script>
    </head>
    <body>
        <%
            String actionType = request.getParameter("actionType");
            String text = "";
            String parsetResult = "";
            UserAgent ua = null;
            if(actionType != null){
                text = request.getParameter("text");
                if("ua".equals(actionType)){
                	ua = UserAgentFactory.createUserAgent(text);
                    parsetResult = ua.toString();
                } else if("xua".equals(actionType)){
                    ua = UserAgentFactory.createXUCBrowserUserAgent(text);
                    parsetResult = ua.toString();
                }
            }
        %>
        <form id="testForm" action="GUITest.jsp" method="post">
            <input type="hidden" name="actionType" id="actionType"/>
            Please input data:
            <textarea rows="5" style="width: 100%" name="text" id="text"><%=text%></textarea>
            <button onclick="parseUserAgent();">Parse User-Agent</button>
            <button onclick="parseXUCBrowserUA();">Parse X-UCBrowser-UA</button>
            <button onclick="clearData();">Clear</button>
            <br>
            Parse result:
            <textarea rows="45" style="width: 100%" name="parsetResult" id="parsetResult" readonly="readonly"><%=parsetResult%></textarea>
        </form>
    </body>
</html>
